<template>
	<div class="setting-cell">
		<div class="s-left">{{ title }}</div>
		<div class="s-right">
			<image class="pic" :src="value || '/static/icons/bg-icon.png' " alt="" mode="aspectFill" :lazy-load="true"
				v-if="mode === 'pic'" />
			<div class="txt" :class="{
				active: active
			}" v-if="!mode || mode === 'text'">{{ value }}</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {};
		},
		props: {
			mode: {
				type: String,
				default: () => {
					return 'pic';
				},
				validator: value => {
					return ['text', 'pic'].indexOf(value) !== -1;
				}
			},
			value: {
				type: String,
				default: () => {
					return '';
				}
			},
			title: {
				type: String
			},
			active: {
				type: Boolean,
				default: () => {
					return false
				}
			}
		},
		methods: {
			handlerUploadPic() {
				let that = this;
				that.$httpRequest.handlerUploadPic(res => {
					if (res) {
						this.$emit('changeAvatar', res.url);
					}
				});
			}
		}
	};
</script>

<style scoped lang="scss">
	.setting-cell {
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 99upx;
		box-sizing: border-box;
		border-bottom: 1rpx solid #D8D8D8;

		.s-left {
			font-size: 28upx;
			color: #000000;
			line-height: 1;
		}

		.s-right {
			font-size: 0;

			.pic {
				width: 60upx;
				height: 60upx;
			}

			.txt {
				font-size: 30upx;
				line-height: 1;
				color: #999;
			}

			.active {
				color: $uni-color-qian !important;
				text-underline: $uni-color-qian;
				// text-decoration: underline;
			}
		}
	}
</style>